package client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class TCPClient {
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		String reply;							// Reply received from the server.
		//int serverPort = Integer.getInteger(args[1]);			// Server port.
		int serverPort;
		//serverPort = Integer.getInteger(args[1]);
		serverPort = 1971;
		InetAddress server = null;				// IP Address of server.
		try {
			server = InetAddress.getByName(args[0]);
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
	
		Socket cliSocket = new Socket(server, serverPort);
		
		BufferedReader cin = new BufferedReader(new InputStreamReader(cliSocket.getInputStream()));
		PrintWriter cout = new PrintWriter(cliSocket.getOutputStream(), true);
		
		cout.println(args[2] + " - " + args[3]);
		
		reply = cin.readLine();
		System.out.println("Devolvido: " + reply);
		
		
	}
}
